import 'package:flutter/foundation.dart';
import 'package:flutter/services.dart';

import 'heic_converter_platform_interface.dart';

/// An implementation of [HeicConverterPlatform] that uses method channels.
class MethodChannelHeicConverter extends HeicConverterPlatform {
  /// The method channel used to interact with the native platform.
  @visibleForTesting
  final methodChannel = const MethodChannel('heic_converter');

  @override
  Future<String?> getPlatformVersion() async {
    final version =
        await methodChannel.invokeMethod<String>('getPlatformVersion');
    return version;
  }

  @override
  Future<String?> convertToJpg(String path) async {
    final rawPath = await methodChannel
        .invokeMethod<String>('convertToJpg', {"path": path});
    return rawPath;
  }

  @override
  Future<String?> convertToPng(String path) async {
    final rawPath = await methodChannel
        .invokeMethod<String>('convertToPng', {"path": path});
    return rawPath;
  }

  @override
  Future<bool?> isBluetoothAudioOutput() async {
    return await methodChannel.invokeMethod<bool>('isBluetoothAudioOutput');
  }
}
